package com.apes.fn.scm.prepare.repository;

import com.apes.fn.scm.prepare.model.ToPrepare;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ToPrepareRepository extends CustomRepository<ToPrepare, String> {

    @Query(value = "SELECT t FROM ToPrepare t WHERE " +
            "t.dept.id = :deptId and t.amount <> t.recoveryAmount and t.paymentType.id=:enumerationId and (t.freezeAmount = t.amount " +
            "or t.freezeAmount != 0) ORDER BY t.paymentMoneyDate ")
    List<ToPrepare> findByaAndDeptId(String deptId, String enumerationId);

}
